package com.lulufind.lulu.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.google.gson.Gson;
import com.lulufind.lulu.model.Result;
import com.lulufind.lulu.model.Section;
import com.lulufind.lulu.service.SectionService;

@Controller
@RequestMapping("/section")
public class SectionController {
	
	@Autowired
	SectionService sectionService;
	
	@ResponseBody
	@RequestMapping(value="/getAllSection",produces="application/json;charset=UTF-8")
	public String getAllSection(){
		
		Result<List<Section>> rs = sectionService.getAllSection();
		
		Gson gson = new Gson();
		String s = gson.toJson(rs);
		return s;
	}
}
